<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!-- saved from url=(0014)about:internet -->
<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>
	LearningDataModel
</title>

<link rel="stylesheet" href="Doc.css" />

</head>

<body id="DocTopic">

<div class="TopicHeader">
	<div class="Supertitle_">
		Microsoft Learning Components
	</div>
	LearningDataModel
</div>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<div class="Summary">

<p>When a package is executed (i.e. learner attempts it), each activity (page) of the package has
a <i>data model</i> as defined by SCORM 2004 and 1.2.</p>

<p>Microsoft Learning Components implements the data model in two ways.  The two examples below
perform the same action&mdash;the first using client code executing in a browser, the second using
server code.</p>

<ol>

	<li>MLC implements the SCORM RTE (JavaScript-based run-time environment) in the
		<a href="MlcFrameset.htm">Session Frameset</a>.  SCORM content can access the RTE using
		JavaScript such as the following:

		<table class="Grid Code">
			<col class="Column1_" />
			<tr class="Header_">
				<td class="Header1_">JavaScript</td>
			</tr>
			<tr>
				<td class="Content_">
					rteapi.SetValue("cmi.completion_status", "completed");
				</td>
			</tr>
		</table>
	</li>

	<li>Applications written in CLR-compatible languages such as C# and Visual Basic can access the
		data model of an activity as follows:

		<table class="Grid Code">
			<col class="Column1_" />
			<tr class="Header_">
				<td class="Header1_">C#</td>
			</tr>
			<tr>
				<td class="Content_">
					learningSession.DataModel.CompletionStatus = CompletionStatus.Completed;
				</td>
			</tr>
		</table>
	</li>

</ol>

<p>The first approach is documented in the SCORM Run-Time Environment documentation.</p>

<p>For the second approach, these are typical steps for accessing the data model of the current
activity of an attempt.</p>
<ol>

	<li>
		Acquire an instance of <a href="Microsoft.LearningComponents.Storage.StoredLearningSession.Class.htm">StoredLearningSession</a>.
		For example, call the
		<a href="Microsoft.LearningComponents.Storage.StoredLearningSession.StoredLearningSession.Method.2.htm">StoredLearningSession constructor</a> or
		<a href="Microsoft.LearningComponents.Storage.StoredLearningSession.CreateAttempt.Method.htm">StoredLearningSession.CreateAttempt</a>.  Note that the following steps assume that the learning
		session has a current activity.
	</li>

	<li> 
		Retrieve the MLC object model corresponding to the current activity's SCORM data model
		by reading the value of the
		<a href="Microsoft.LearningComponents.Storage.StoredLearningSession.CurrentActivityDataModel.Property.htm">StoredLearningSession.CurrentActivityDataModel</a>
		property.
	</li>

	<li>
		Use methods and properties of the returned
		<a href="Microsoft.LearningComponents.DataModel.LearningDataModel.Class.htm">LearningDataModel</a>
		object to read and/or write the data model for the current activity.
	</li>

	<li>
		If you wrote to the data model, call
		<a href="Microsoft.LearningComponents.Storage.StoredLearningSession.CommitChanges.Method.htm">StoredLearningSession.CommitChanges</a> to write the changes back to the database.
	</li>
</ol>

</div>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<div class="SectionHeader">For More Information</div>
<div class="Section">

<div><a href="Microsoft.LearningComponents.DataModel.Namespace.htm">Microsoft.LearningComponents.DataModel Namespace (API Reference)</a></div>
<div><a href="Microsoft.LearningComponents.DataModel.LearningDataModel.Class.htm">LearningDataModel Class (API Reference)</a></div>
<div><a href="Microsoft.LearningComponents.Storage.StoredLearningSession.CurrentActivityDataModel.Property.htm">StoredLearningSession.CurrentActivityDataModel (API Reference)</a></div>

</div>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<div class="SectionHeader"></div>
<div class="Section">
<b><a href="MlcLearningStore.htm">Next Topic: LearningStore</a></b>
</div>

<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<div class="TopicFooter">
</div>

<div class="PageFooter">
Copyright &copy; Microsoft Corporation.&nbsp; All rights reserved.
</div>

</body>

</html>

